#ifndef _BUOLA_WIDGETS_CLISTVIEW_H_
#define _BUOLA_WIDGETS_CLISTVIEW_H_

#include <buola/gui/cwindow.h>
#include <buola/utility/udelegate.h>

namespace buola { namespace gui {

class CListView;
    
struct DListViewDelegate : public UDelegate<DListViewDelegate>
{
    virtual PWindow GetListViewCell(CListView *pListView,int pSection,int pPos)=0;
    virtual int GetListViewCellCount(CListView *pListView,int pSection)=0;
};
    
class CListView : public CWindow
{
public:
    CListView();
    ~CListView();

public:
    void SetListViewDelegate(DListViewDelegate *pDelegate);
    
private:
////////////// Event handling //////////////
    void OnLayout() override;
    void OnMouseWheel(const CMouseEvent &pE) override;
    void OnExpose(const CExposeEvent &pE) override;

private:
    delegate_ptr<DListViewDelegate> mDelegate;
};

typedef intrusive_ptr<CListView> PListView;

/*namespace gui*/ } /*namespace buola*/ }

#endif
